const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = {
  entry: {
    main: './src/index.js',
    sub: './src/index.js'
  },
  devtool: 'cheap-source-map',
  module: {
    rules: [{
      test: /\.css$/,
      use: ['style-loader', 'css-loader']
    }]
  },
  plugins: [new htmlWebpackPlugin({
    template: './src/index.html'
  }), new CleanWebpackPlugin({
    cleanOnceBeforeBuildPatterns: [path.resolve(__dirname, 'dist')]
  })],
  output: {
    publicPath: 'http://baidu.com',
    filename: '[name].js',
    path: path.resolve(__dirname, 'dist')
  },
  mode: 'development'
}